package com.blog.security.service;

import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.blog.security.entity.AuthUserDetails;
import com.blog.security.mapper.HrMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.ReactiveUserDetailsService;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;

/**
 * @ClassName SecurityUserDetailSevice
 * @Destription userService 的实现，与springboot不同，这里用ReactiveUserDetailsService
 * @Author 天堂小野花
 * @Date 2025/8/10  19:11
 * @Version 1.0
 */
@Service
public class SecurityUserDetailSevice implements ReactiveUserDetailsService {
    @Autowired
    HrMapper hrMapper;
    @Override
    public Mono<UserDetails> findByUsername(String username) {
        AuthUserDetails hr = hrMapper.loadUserByUsername(username);
        return Mono.just(hr);
    }
}
